#!/usr/bin/env python
# encoding: utf-8

"""
@version: ??
@author: rourou 
@license: MIT 
@software: PyCharm Community Edition
@file: hw_client.py.py
@time: 2018/1/23 下午3:08
"""

import time
import grpc

import hw_pb2, hw_pb2_grpc


def run():
    channel = grpc.insecure_channel('localhost:50051')
    stub = hw_pb2_grpc.GreeterStub(channel)
    st = time.clock()
    response = stub.SayHello(hw_pb2.HelloRequest(name='you'))
    et = time.clock()
    print("Greeter client received: " + response.message)
    print("time consuming: {}".format(et-st) )


if __name__ == "__main__":
    run()
